|
1
|
|
|
// jshint esversion: 8, -W104, -W069 |
|
2
|
|
|
|
|
3
|
|
|
// Base path --> assets/html |
|
4
|
|
|
const electron = require('electron'), |
|
5
|
|
|
path = require('path'), |
|
|
|
|
|
|
6
|
|
|
app = electron.remote.app, |
|
7
|
|
|
fs = require('fs'); |
|
8
|
|
|
|
|
9
|
|
|
const { |
|
10
|
|
|
ipcRenderer, |
|
11
|
|
|
remote, |
|
12
|
|
|
dialog |
|
13
|
|
|
} = electron; |
|
14
|
|
|
|
|
15
|
|
|
window.$ = window.jQuery = require('jquery'); |
|
16
|
|
|
|
|
17
|
|
|
require('../js/renderer/index'); |
|
18
|
|
|
|
|
19
|
|
|
var settings = require('../js/common/settings').load(); |
|
20
|
|
|
|
|
21
|
|
|
/* |
|
22
|
|
|
$(document).ready(function() {...}); |
|
23
|
|
|
When document is ready |
|
24
|
|
|
*/ |
|
25
|
|
|
$(document).ready(function() { |
|
26
|
|
|
const { |
|
27
|
|
|
'custom.configuration': configuration |
|
28
|
|
|
} = settings; |
|
29
|
|
|
|
|
30
|
|
|
ipcRenderer.send('app:debug', "Document is ready"); |
|
31
|
|
|
|
|
32
|
|
|
// Load custom configuration at startup |
|
33
|
|
|
if (fs.existsSync(app.getPath('userData') + configuration.filepath)) { |
|
|
|
|
|
|
34
|
|
|
ipcRenderer.send('app:debug', "Reading persistent configurations"); |
|
35
|
|
|
settings = fs.readFile(app.getPath('userData') + configuration.filepath); |
|
36
|
|
|
} else { |
|
37
|
|
|
ipcRenderer.send('app:debug', "Using default configurations"); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
startup(); |
|
41
|
|
|
require('../js/renderer/navigation'); |
|
42
|
|
|
}); |
|
43
|
|
|
|
|
44
|
|
|
/* |
|
45
|
|
|
startup |
|
46
|
|
|
Application startup checks |
|
47
|
|
|
*/ |
|
48
|
|
|
function startup() { |
|
49
|
|
|
const { |
|
50
|
|
|
'app.window.navigation': navigation |
|
51
|
|
|
} = settings; |
|
52
|
|
|
|
|
53
|
|
|
ipcRenderer.send('app:debug', "'navigation.developerTools': {0}".format(navigation.developerTools)); |
|
|
|
|
|
|
54
|
|
|
if (navigation.developerTools) $('#navTabDevtools').removeClass('is-force-hidden'); |
|
55
|
|
|
|
|
56
|
|
|
ipcRenderer.send('app:debug', "'navigation.extendedcollapsed': {0}".format(navigation.extendedCollapsed)); |
|
57
|
|
|
if (navigation.extendedCollapsed) { |
|
58
|
|
|
$('#navButtonExpandedmenu').toggleClass('is-active'); |
|
59
|
|
|
$('.is-specialmenu').toggleClass('is-hidden'); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
ipcRenderer.send('app:debug', "'navigation.extendedmenu': {0}".format(navigation.enableExtendedMenu)); |
|
63
|
|
|
if (navigation.enableExtendedMenu) $('#navButtonExpandedmenu').addClass('is-force-hidden'); |
|
64
|
|
|
} |
|
65
|
|
|
|